﻿using System;

namespace Clipping.Infrastructure.Models
{
    [Serializable]
	public abstract class SearchObject
	{


		protected SearchObject(string keyword, SearchType searchType= SearchType.SearchInTitle)
		{
			//Contract.Requires(!string.IsNullOrEmpty(keyword));
			//Contract.Requires(!string.IsNullOrEmpty(keyword.Trim()));
			this.Keyword = keyword;
			this.SearchType = searchType;
		}

	
		
		/// <summary>
		/// 获取或设置关键词
		/// </summary>
		public string Keyword
		{
			get;
			set;
		}

		/// <summary>
		/// 获取或设置搜索类型
		/// </summary>
		public SearchType SearchType
		{
			get;
			set;
		}

		


	}
       [Serializable]
	public class PeriodSearchObject : SearchObject
	{
		public PeriodSearchObject(string keyword, SearchType searchType = SearchType.SearchInTitle,SearchPeriod searchPeriod= Models.SearchPeriod.全部时间):base(keyword,searchType)
		{
			this.SearchPeriod = searchPeriod;
		}
		/// <summary>
		/// 获取或设置时间段
		/// </summary>
		public SearchPeriod SearchPeriod
		{
			get;
			set;
		}
	}
	public class TimespanSearchObject : SearchObject
	{
		public TimespanSearchObject(string keyword,DateTime startTime,DateTime endTime, SearchType searchType = SearchType.SearchInTitle) :base(keyword,searchType)
		{
			this.StartTime = startTime;
			this.EndTime = endTime;
		}

		public DateTime StartTime { get; private set; }
		public DateTime EndTime { get; private set; }
	}
}
